#include "lcd_app.h"

void LCD_printf(uint8_t Line,char *format,...)
{
    char string[21] = {0};
    va_list arg;
    va_start(arg, format);
    vsprintf(string, format, arg);
    va_end(arg);
    LCD_DisplayStringLine(Line, (u8 *)string);
}

uint8_t show_mode;//0密码模式，1输出状态界面
char pass_word[3] = {'@', '@', '@'}; // B1,B2,B3
char pass_word_true[3] = {'1', '2', '3'}; // B1,B2,B3
uint16_t duty = 50;
uint16_t Freq = 1000;
uint8_t clear_mode;
void lcd_proc(void)
{

    if(show_mode == 0)
    {
        if (clear_mode == show_mode)
        {
            clear_mode ^= 1;
            LCD_Clear(Black);
        }
            LCD_printf(Line1, "       PSD ");
        LCD_printf(Line3, "    B1:%c ", pass_word[0]);
        LCD_printf(Line4, "    B1:%c ", pass_word[1]);
        LCD_printf(Line5, "    B1:%c ", pass_word[2]);
    }
    else
    {
        if (clear_mode == show_mode)
        {
            clear_mode ^= 1;
            LCD_Clear(Black);
        }
        LCD_printf(Line1, "       STA ");
        LCD_printf(Line3, "    F:%dHz     ",Freq);
        LCD_printf(Line4, "    D:%d%c ",duty,'%');
        //LCD_printf(Line5, "        ");
    }
}

